#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sqlite3

HOME_PATH = os.path.dirname(os.path.abspath(__file__))

TOKEN = '3e77f0822f8f7ecea13232ea81541b7cdf4a674273a57a4e0da0ef0a'

DEBUG = False if str(os.environ.get("QTRADE_NOT_DEBUG")) == "1" else True
ISDEV = False if str(os.environ.get("QTRADE_NOT_DEV")) == "1" else True

DB = "qtrade"
if ISDEV:
    DBNAME = "/mnt/e/pyProj/qtrade/qtrade/qtrade.db"
else:
    DBNAME = "/root/work/qtrade/qtrade/qtrade/qtrade.db"


DATABASES_POOL = {
    DB: {
        "engine": sqlite3,
        "database": DBNAME,
        "maxconnections": 10,
    },
}


class BACKTESTSTATUS():
    NONE = 0     # 无状态
    RUNNING = 1  # 正在运行
    SUCCESS = 2  # 运行成功
    WARNING = 3  # 运行告警
    ERROR = 4    # 错误


# 图表对应的聚合类型
DATAVIEW_POLYMERIZATION_TYPE = ["day", "month"]


class EntityStatus:
    DISABLE = 0  # 禁用
    NORMAL = 1  # 正常


class UserStatus:
    DISABLE = 0  # 禁用
    NORMAL = 1  # 正常
    PENDING = 2  # 待审核


class GroupStatus:
    DISABLE = 0  # 禁用
    NORMAL = 1  # 正常
